package com.campus.counseling.model.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.campus.counseling.entity.Counselor;
import com.campus.counseling.model.dto.CounselorDTO;
import com.campus.counseling.model.vo.CounselorVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CounselorMapper extends BaseMapper<Counselor> {
    
    /**
     * 分页查询咨询师列表
     */
    Page<Counselor> selectCounselorPage(Page<Counselor> page, @Param("query") CounselorDTO query);

    /**
     * 查询待审核咨询师列表
     */
    Page<CounselorVO> selectPendingList(Page<CounselorVO> page, @Param("status") String status);
    
    /**
     * 根据用户名查询咨询师信息
     */
    Counselor selectByUsername(@Param("username") String username);

    @Select("SELECT id FROM counselor_info WHERE user_id = #{userId}")
    Long selectCounselorIdByUserId(Long userId);

    /**
     * 根据咨询师ID查询用户ID
     * @param counselorId 咨询师ID
     * @return 用户ID
     */
    Long selectUserIdByCounselorId(Long counselorId);
} 